/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package group2assignone.ucm.manager;

import group2assignone.dao.ClientComms;
import group2assignone.model.Manager;
import group2assignone.ucm.UCController;
import group2assignone.ucm.UCStartup;
import group2assignone.view.ClientListView;
import java.util.ArrayList;

/**
 * Use Case: Show Client List View UI                                       <br>
 * Pre-condition: Manager has clicked 'View Users' from Manager main view   <br>
 * Post-condition: UI is updated.                                           <br>
 * 1. System retrieves list of user from client.                            <br>
 * 2. System displays client list.
 * @author group2                                                           <br>
 */
public class UCUIClientListView implements UCController {

    Manager man;
    ClientListView gui2;

    public UCUIClientListView(Manager man) {
    this.man = man;
    }
    
    /**
     *Use Case Controller - displays a list of online users.
     */
    public void run() {
        //1. System retrieves list of user from client.
        ClientComms c = UCStartup.getInstance().getClientComms();
        ArrayList<String> list = new ArrayList<String>(c.getClientList());
        //2. System displays client list.
        gui2 = new ClientListView(list, man);
        gui2.go();
        c.monitorClientView(gui2);
    }
}
